from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

from app.constants import TableConstant

Base = declarative_base()


class DbiProvince(Base):
    __tablename__ = TableConstant.DBI_PROVINCE
    id = Column(Integer, primary_key=True)
    name = Column(String)
    pinyin = Column(String)

    def __init__(self, id, name, pinyin):
        self.id = id
        self.name = name
        self.pinyin = pinyin

    def to_dict(self):
        return {"id": self.id, "name": self.name, "pinyin": self.pinyin}
